package com.xiaomage.view.draw5

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.view.View

/**
 * Created by Administrator on 2018/1/2.
 */
class DrawTextView2(context: Context): View(context) {
    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)

        val x=400f
        val y=300f

        val paint= Paint()
        paint.isAntiAlias=true
        paint.style= Paint.Style.STROKE
        paint.color= Color.RED

        val paint2= Paint()
        paint2.isAntiAlias=true
        paint2.style= Paint.Style.STROKE
        paint2.color= Color.BLACK
        paint2.textSize=120f

        canvas.drawLine(x,y,1000f,y,paint)


        paint2.textAlign= Paint.Align.CENTER
        canvas.drawText("X",x,y,paint2)
    }
}